package cn.zd.erp.auth.emp.action;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.Action;

import cn.zd.erp.auth.emp.service.ebi.EmpEbi;
import cn.zd.erp.auth.emp.vo.EmpModel;
import cn.zd.erp.util.base.Grid;

public class EmpAction {
	private EmpModel emp;
	@Autowired
	private EmpEbi empEbi;
	private Grid grid;

	public Grid getGrid() {
		return grid;
	}

	public String loign() {
		System.out.println("进来了..");
		// System.out.println(emp.getPassword()+"---------------");
		// System.out.println(emp.getLoginname()+"---------------");
		EmpModel em;
		List footer = new ArrayList<>();
		List rows = new ArrayList<>();

		for (int i = 0; i < 10; i++) {
			em = new EmpModel();
			em.setLoginname("hpx" + i);
			em.setName("ok" + i);
			footer.add(em);
		}
		String userName = "hpx";
		String pwd = "123456";
		rows.add(empEbi.login(userName, pwd));

		grid = new Grid();
		grid.setFooter(footer);
		grid.setTotal(10L);
		grid.setRows(rows);
		System.out.println("--------------");
		return Action.SUCCESS;
	}

	public EmpModel getEmp() {
		return emp;
	}

	public void setEmp(EmpModel emp) {
		this.emp = emp;
	}

}
